#include"stdio.h"
#include"time.h"
#include"stdlib.h"
int main()
{int a,b,i;
printf("进行猜数游戏\n");
srand(time(NULL));
printf("从1-100中猜一个数字并输入");


while(scanf("%d",&b)!=EOF){
    a=rand()%100+1;
	for(i=0;i<10;i++)
	{
		 if(a==b){ 
		   printf("恭喜你猜对了");
		   printf("猜了%d次",i+1);
		   break;}
	   if(a>b){printf("你的数猜小了");}
	   if(a<b){printf("你的数猜大了");}
	  
	 
	   if(i==9){printf("游戏结束");break;}
	 
	   scanf("%d",&b);
	}
}
return 0;
}